home *** CD-ROM | disk | FTP | other *** search
/ Floppyshop 2 / Floppyshop - 2.zip / Floppyshop - 2.iso / diskmags / 0022-3.564 / dmg-0138 / king.txt < prev    next >
Text File  |  1997-04-16  |  4KB  |  77 lines

  1. ------- Forwarded Message (origin lost in the mists of time)
  2.  
  3. Once upon a time, in a kingdom not far from here, a king summoned two
  4. of his advisors for a test.  He showed them both a shiny metal box with
  5. two slots in the top, a control knob, and a lever.  "What do you think
  6. this is?"
  7.  
  8. One advisor, an engineer, answered first. "It is a toaster," he said.
  9. The king asked, "How would you design an embedded computer for it?" The
  10. engineer replied, "Using a four-bit microcontroller, I would write a
  11. simple program that reads the darkness knob and quantizes its position
  12. to one of 16 shades of darkness, from snow white to coal black. The
  13. program would use that darkness level as the index to a 16-element
  14. table of initial timer values.  Then it would turn on the heating
  15. elements and start the timer with the initial value selected from the
  16. table.  At the end of the time delay, it would turn off the heat and
  17. pop up the toast.  Come back next week, and I'll show you a working
  18. prototype."
  19.  
  20. The second advisor, a computer scientist, immediately recognized the
  21. danger of such short-sighted thinking.  He said, "Toasters don't just
  22. turn bread into toast, they are also used to warm frozen waffles.  What
  23. you see before you is really a breakfast food cooker.  As the subjects
  24. of your kingdom become more sophisticated, they will demand more
  25. capabilities.  They will need a breakfast food cooker that can also
  26. cook sausage, fry bacon, and make scrambled eggs.  A toaster that only
  27. makes toast will soon be obsolete.  If we don't look to the future, we
  28. will have to completely redesign the toaster in just a few years."
  29.  
  30. "With this in mind, we can formulate a more intelligent solution to the
  31. problem.  First, create a class of breakfast foods. Specialize this
  32. class into subclasses:  grains, pork, and poultry.  The specialization
  33. process should be repeated with grains divided into toast, muffins,
  34. pancakes, and waffles; pork divided into sausage, links, and bacon; and
  35. poultry divided into scrambled eggs, hard-boiled eggs, poached eggs,
  36. fried eggs, and various omelet classes."
  37.  
  38. "The ham and cheese omelet class is worth special attention because it
  39. must inherit characteristics from the pork, dairy, and poultry
  40. classes.  Thus, we see that the problem cannot be properly solved
  41. without multiple inheritance.  At run time, the program must create the
  42. proper object and send a message to the object that says, 'Cook
  43. yourself.'  The semantics of this message depend, of course, on the
  44. kind of object, so they have a different meaning to a piece of toast
  45. than to scrambled eggs."
  46.  
  47. "Reviewing the process so far, we see that the analysis phase has
  48. revealed that the primary requirement is to cook any kind of breakfast
  49. food.  In the design phase, we have discovered some derived
  50. requirements.  Specifically, we need an object-oriented language with
  51. multiple inheritance.  Of course, users don't want the eggs to get cold
  52. while the bacon is frying, so concurrent processing is required, too."
  53.  
  54. "We must not forget the user interface.  The lever that lowers the food
  55. lacks versatility, and the darkness knob is confusing.  Users won't buy
  56. the product unless it has a user-friendly, graphical interface.  When
  57. the breakfast cooker is plugged in, users should see a cowboy boot on
  58. the screen.  Users click on it, and the message 'Booting UNIX v. 8.3'
  59. appears on the screen. (UNIX 8.3 should be out by the time the product
  60. gets to the market.)  Users can pull down a menu and click on the foods
  61. they want to cook."
  62.  
  63. "Having made the wise decision of specifying the software first in the
  64. design phase, all that remains is to pick an adequate hardware platform
  65. for the implementation phase.  An Intel 80386 with 8MB of memory, a
  66. 30MB hard disk, and a VGA monitor should be sufficient.  If you select
  67. a multitasking, object oriented language that supports multiple
  68. inheritance and has a built-in GUI, writing the program will be a
  69. snap.  (Imagine the difficulty we would have had if we had foolishly
  70. allowed a hardware-first design strategy to lock us into a four-bit
  71. microcontroller!)."
  72.  
  73. The king had the computer scientist thrown in the moat, and they
  74. all lived happily ever after.
  75.  
  76. ----------------------------------------------------
  77.